Ext.define('TD.view.task.EditView', {
    extend: 'Ext.window.Window',
    
    alias : 'widget.taskedit',

    title : 'Edit Task',
    
    layout: 'fit',
    
    autoShow: true,
    
    width: 597,
    
    height: 300,
    
    resizable: false,
    
    modal: true,
    
    initComponent: function() {
        this.items = [
            {
                xtype: 'form',
                items: [
                    {
                    	xtype: 'panel',
                        height: 45,
                        border: false,
                    	layout: {
                            type: 'hbox',
                            align: 'stretch'
                        },
                    	items: [
                            {
                                xtype: 'combobox',
                                name : 'status',
                                fieldLabel: 'Status',
                                allowBlank: false,
                                labelWidth: 70,
                                width: 170,
                                store: Ext.create('TD.store.StatusStore'),
                                displayField: 'status',
                                valueField: 'status',
                                editable: false,
                                value: 'New',
                                forceSelection: true,
                                margin: '5 5 5 10'
                            },
                            {
                                xtype: 'combobox',
                                name : 'priority',
                                fieldLabel: 'Priority',
                                allowBlank: false,
                                labelWidth: 50,
                                width: 150,
                                store: Ext.create('TD.store.PriorityStore'),
                                displayField: 'priority',
                                valueField: 'priority',
                                editable: false,
                                value: 'Medium',
                                forceSelection: true,
                                margin: '5 5 5 10'
                            },
                            {
                                xtype: 'datefield',
                                name : 'duedate',
                                fieldLabel: 'Due Date',
                                allowBlank: false,
                                labelWidth: 70,
                                width: 170,
                                value: new Date(),
                                format: 'Y-m-d',
                                margin: '5 5 5 5'
                            }
                        ]
                    },
                    {
                        xtype: 'panel',
                        height: 250,
                        border: false,
                        layout: {
                            type: 'vbox',
                            align: 'stretch'
                        },
                        items: [
                            {
                                xtype: 'textfield',
                                name : 'subject',
                                fieldLabel: 'Subject',
                                labelWidth: 70,
                                allowBlank: false,
                                margin: '5 12 5 10'
                            },
                            {
                                xtype: 'textarea',
                                name : 'description',
                                fieldLabel: 'Description',
                                labelWidth: 70,
                                height: 120,
                                margin: '5 12 5 10'
                            }
                        ]
                    }
                ]
            }
        ];

        this.buttons = [
            {
                text: 'Save',
                action: 'save'
            },
            {
                text: 'Cancel',
                scope: this,
                handler: this.close
            }
        ];

        this.callParent(arguments);
    }
});